home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Gamer Resource Kit / Hardcore Gamer Resource Kit - Disc 3.iso / screensavers / saver17.zip / VoodooLights / Sources / cell_tp4.c < prev    next >
C/C++ Source or Header  |  1997-07-24  |  2KB  |  101 lines

  1. /*------------------------------------------------------/
  2. /                                                        /
  3. /    Copyright 1997, SΘrgio Durte <smd@di.fct.unl.pt>    /
  4. /                                                        /
  5. /------------------------------------------------------*/
  6.  
  7.  
  8. #include <stdlib.h>
  9. #include <glide.h>
  10.  
  11. #include "defines.h"
  12. #include "mat.h"
  13. #include "rgb.h"
  14. #include "clip.h"
  15. #include "tex.h"
  16. #include "cam.h"
  17. #include "cell.h"
  18. #include "cell_util.h"
  19. #include "cell_tp1.h"
  20. #include "cell_tp2.h"
  21. #include "cell_tp3.h"
  22. #include "cell_tp4.h"
  23.  
  24. static Bool first_init = True ;
  25. static GrMipMapId_t tp4_texture_src ;
  26.  
  27. static void tp4_acc_cell(Cell *c) 
  28. {
  29.   int n ;
  30.   Cell **p ;
  31.   
  32.   mat_scalev( 0.95, & c->vel, & c->vel ) ;
  33.  
  34. }
  35.  
  36. static void tp4_age_cell( Cell *c )
  37. {
  38.     c->age += dt ;
  39.     if( c->age > c->adulthood ) c->status = DYING ;
  40.  
  41.     c->color.r *= 0.965 ;
  42.     c->color.g *= 0.965 ;    
  43.     c->color.b *= 0.965 ;
  44. }
  45.  
  46. void tp4_set_glide_state( void )
  47. {
  48.     if( first_init ) {
  49.         first_init = False ;
  50.         tp4_texture_src = tex_InitTexture("flare1.3df") ;
  51.     }
  52.     
  53.     tex_SetTexSource( tp4_texture_src ) ;
  54.     guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB ) ;
  55.     guAlphaSource( GR_ALPHASOURCE_ITERATED_ALPHA );    
  56.     grAlphaBlendFunction( GR_BLEND_ONE, GR_BLEND_ONE, GR_BLEND_ONE, GR_BLEND_ZERO );
  57.  
  58. }
  59.  
  60. Cell *ctp4_Constructor( Cell *dad )
  61. {
  62.  
  63.   Cell *c = cell_Constructor( CellType4 ) ;
  64.  
  65.   c->max_speed = 65.0 ;
  66.  
  67.   c->dad = dad ;
  68.  
  69.   c->max_chld = 1 ;
  70.   c->p_chld = 0.0 ;
  71.  
  72.   c->adulthood = 4.0 ;
  73.   c->size = 6.0 ;
  74.  
  75.   c->sparkle = 1.0 ;
  76.   c->sparkle_min = 0.5 ;
  77.   c->sparkle_range = 0.2 ;
  78.  
  79.   if( dad ) {
  80.     c->pos = dad->pos ;
  81.     c->vel = dad->vel ;
  82.   }
  83.   rgb_random_color( & c->color ) ;
  84.  
  85.  
  86.   c->acc_cell = tp4_acc_cell ; 
  87.   c->age_cell = tp4_age_cell ; 
  88.  
  89.   return c ;
  90. }  
  91.     
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.     
  100.  
  101.